# print("hello 大厂们")
#
# print("键盘敲烂")
#
# # 注释


"""
多行注释
。
。。

。
"""
import winsound

# from binascii import a2b_hex
# from os import write
# from time import sleep
#
# from pandas.core.window.doc import kwargs_scipy
# from pandas.io.parquet import to_parquet

# from itertools import l


#
# money = 50
# money -= 10
# money -= 5
# print(type(money))

# type_string = type("12232")
# type_int = type(31)
# type_float = type(2.3)
# print(type_string)
# print(type_int)
# print(type_float)

# val = 10
# print(val)
# print(type(val))
# print()
#
# val_str = str(val)
# print(val_str)
# print(type(val_str))
# print()
#
# val_float = float(val)
# print(val_float)
# print(type(val_float))
# print()
#
# str2int = "我不是数字"
# num = int(str2int)

# monkey_king = {"name":"孙悟空", "age":600, "skills":["筋斗云", "七十二变"], "war record":"大闹天宫"}
# print(monkey_king["name"], monkey_king["age"], monkey_king["skills"], monkey_king['war record'])
# l1 = [1, 2, 3]
# t1 = (1, 2, 3)
# print(l1[1])
# print(t1[1])
# s1 = {1, 2, 3}
# print(s1)
#
# print(2**6)

# print(type(5/2))

# name = 'yjy'
# print(name)
# name = "fangzhang"
# print(name)
# name = """clay"""
# print(name)

# name = 'yjy' + " fangzhang " + "clay"
# print(name)
#
# name = 'yjy'
# birth = 2003
# print("我是" + name + ", 出生于" + str(birth))

# name = 'yjy'
# birth = 2003
# weight = 143.5
# # print("我是 %s, 我出生于 %d 年, 体重为 %.2f" % (name, birth, 143.5))
# print(f"我是{name}, 出生于{2003}, 体重{weight}")
# print(f"1*1 = {1*1}")
# print("字符串类型：%s" % type('字符串'))

# name = input("你是谁?\n")
# print(name)

# import random
#
# num = random.randint(1,10)
#
# i = 0
# while i < 5 :
#     val = int(input("输入数字: "))
#     if val < num :
#         print("小了")
#     elif val > num:
#         print("大了")
#     else:
#         print("猜对了")
#         break
#     i += 1
#
# str = "nihaoa"
# for c in str:
#     print(c, end=' ')

#tup = (1, 2, 3)
# for c in tup:
#     print(c, end=' ')

# li = [1, 2, 3]
# for c in li:
#     print(c, end=' ')

# s = {1:2, 2:3, 3:4}
# print(type(s))
# for c in s:
#     print(c, end=': ')
    # print(type(c))
    # for e in c:
    #     print(c, end=' ')
    # print()

# nums = range(10)
# for i in nums:
#     print(i)

# nums = range(1, 100)
# for e in nums:
#     if e % 2:
#         print(e, end=' ')

# for i in range(10):
#     print(i, end=' ')
#
# print(i + 10)

# for i in range(1, 10):
#     for j in range(1, i + 1):
#         print(f"{j} * {i} = {i * j}", end='\t')
#     print()

# l = 0
# def test_len(i_str) -> int:
#     """
#
#     :param i_str:
#     :return:
#     """
#     global l
#     for i in i_str:
#         l += 1
#     return l
#
# # l = test_len("12345")
# # print(l)
# test_len("132")
# print(l)

# l = list(10)
# print(type(l))
# for i in l:
#     print(i)

# l = list()
# print(type(l))

#l1 = ["hello", "world", "I", "I", "am", "clay"]
# print(l1)

# t1 = ("1323",)
#
# print(type(t1))


# str1 = "hello world, I am clay"
# i = str1.strip()
# print(i)
#
# str1 = "12345"
# print(str1[1:4])
# print(str1[:])
# print(str1[::2])
# print(str1[:4:2])
#
# str1 = "万过薪月，员序程马黑来，nohtyP学"
# print(str1[9:4:-1])

#s1 = {"hello", "world"}
# s1.discard("hello")
# print(s1)
# s1.add("clay")
# print(s1)
# ele = s1.pop()
# print(s1)
# print(ele)

# s = {}
# print(type(s))

# d1 = {1:2, 2:3}
# for k,v in d1:
#     print(k, v)

# d1 = dict()
# print(type(d1))

# d1 = {1:2, 2:3}
# print(max(d1))
# for key in d1:
#     print(key, d1[key])

# def test_func(name, age, gender):
#     print(name, age, gender)
#
# test_func(name="clay", age=22, gender="男")
# test_func(age=22, name="clay", gender="男")
# test_func(gender="男", age=22, name="clay")
#
# def test_func(*args):
#     print(args)
#
# test_func("tom", "120", 123, (1, 2))

# def test_func(**kwargs):
#     print(kwargs)
#
# test_func(name='tom', age=20, id=1)

# def test_func(compute)->int:
#     res = compute(1, 2) + compute(3, 4)
#     return compute(res, res)
#
# print(test_func(lambda x, y: x + y))
#
# try:
#     f = open("linux.txt", 'r')
# except:
#     f = open("linux.txt", 'w')
#
# # write(f, "wwww")
#
# f.close()

# try:
#     a = 1 / 0
# except Exception as exception:
#     print(exception)

# try:
#     print(1)
# except Exception as e:
#     print(e)
# else:
#     print("no err")

# try:
#     f = open("linux.txt", 'r')
# except:
#     f = open("linux.txt", 'w')
# finally:
#     f.close()
#     print("close")

# def func1():
#     print("start - func1")
#     1 / 0
#     print("end - func1")
#
# def func2():
#     print("start - func2")
#     func1()
#     print("end - func2")
#
# def main():
#     try:
#         func2()
#     except Exception as e:
#         print(e)
#
# main()

# from test_module import test
# test()

# import time
# # time.sleep(2)
# print(time.thread_time())

# from time import sleep
# sleep(1)
# print(111)
#
# from test_module import test
# test()

# import my_moudle.my_moudle1
# from my_moudle.my_moudle1 import test1
# from my_moudle.my_moudle2 import test2
#
#
# my_moudle.my_moudle1.test1()
# my_moudle.my_moudle2.test2()
#
# test1()
# test2()
#
# s1 = "123"
# print(s1[::-1])

# class my_class:
#     name=None
#
#     def func(self):
#         print(self.name)
#
# mc = my_class()
# print(mc.name)
#
# class Ring:
#     def ring(self):
#         winsound.Beep(2000, 3000)
#
# Ring().ring()

# class Person:
#     name=None
#     age=None
#     __prival = None
#
#     def __init__(self, name, age, prival = 10):
#         self.name = name
#         self.age = age
#         self.__prival = prival
#
#     def pr(self):
#         print(self.name, self.age, self.__prival)
#         print(self)
#
# Person("lala", 10, 20).pr()

# pass

# class Phone:
#     imei = None
#     producer = "base pro"
#
#     def call_by_5g(self):
#         print("base 5g")
#
#
# class MyPhone(Phone):
#     producer = "derive pro"
#     def call_by_5g(self):
#         print(f"base: {Phone.producer}")
#         Phone.call_by_5g(self)
#
#         print(f"base: {super().producer}")
#         super().call_by_5g()
#
#         print("derive 5g")
#
# MyPhone().call_by_5g()

# class Stu:
#     def func(self, var: int):
#         print(var)

# l1: list[int, int, int] = [1, 2, 'sss']
# t1: tuple[str, str, int] = ('111', 111, 11)
# print(t1)
# s1: set[int] = {1, 2, 3}
# print(s1)

# d1: dict[str:int, int:int] = {"itheima": 666, 1:2}
# print(d1)

# class Animal:
#     def speak(self):
#         pass
#
# class Dog(Animal):
#     def speak(self):
#         print("dog say")
#
# class Cat(Animal):
#     def speak(self):
#         print("cat say")
#
# def make_noise(animal: Animal):
#     animal.speak()
#
# make_noise(Dog())
# make_noise(Cat())

import redis

# 连接到 Redis 服务器
r = redis.Redis(host="49.4.115.8", port=6379, db=0)

# 字符串类型（6 个）
r.set('str_key1', 'Value for string 1')
r.set('str_key2', 'Value for string 2')
r.set('str_key3', 'Value for string 3')
r.set('str_key4', 'Value for string 4')
r.set('str_key5', 'Value for string 5')
r.set('str_key6', 'Value for string 6')

# 哈希类型（6 个，每个哈希包含 2 个字段）
r.hset('hash_key1', 'field1', 'hash_value1_1')
r.hset('hash_key1', 'field2', 'hash_value1_2')
r.hset('hash_key2', 'field1', 'hash_value2_1')
r.hset('hash_key2', 'field2', 'hash_value2_2')
r.hset('hash_key3', 'field1', 'hash_value3_1')
r.hset('hash_key3', 'field2', 'hash_value3_2')
r.hset('hash_key4', 'field1', 'hash_value4_1')
r.hset('hash_key4', 'field2', 'hash_value4_2')
r.hset('hash_key5', 'field1', 'hash_value5_1')
r.hset('hash_key5', 'field2', 'hash_value5_2')
r.hset('hash_key6', 'field1', 'hash_value6_1')
r.hset('hash_key6', 'field2', 'hash_value6_2')

# 列表类型（6 个，每个列表添加 2 个元素）
r.lpush('list_key1', 'list_element1_1')
r.lpush('list_key1', 'list_element1_2')
r.lpush('list_key2', 'list_element2_1')
r.lpush('list_key2', 'list_element2_2')
r.lpush('list_key3', 'list_element3_1')
r.lpush('list_key3', 'list_element3_2')
r.lpush('list_key4', 'list_element4_1')
r.lpush('list_key4', 'list_element4_2')
r.lpush('list_key5', 'list_element5_1')
r.lpush('list_key5', 'list_element5_2')
r.lpush('list_key6', 'list_element6_1')
r.lpush('list_key6', 'list_element6_2')

# 集合类型（6 个，每个集合添加 2 个成员）
r.sadd('set_key1', 'set_member1_1')
r.sadd('set_key1', 'set_member1_2')
r.sadd('set_key2', 'set_member2_1')
r.sadd('set_key2', 'set_member2_2')
r.sadd('set_key3', 'set_member3_1')
r.sadd('set_key3', 'set_member3_2')
r.sadd('set_key4', 'set_member4_1')
r.sadd('set_key4', 'set_member4_2')
r.sadd('set_key5', 'set_member5_1')
r.sadd('set_key5', 'set_member5_2')
r.sadd('set_key6', 'set_member6_1')
r.sadd('set_key6', 'set_member6_2')

# 有序集合类型（6 个，每个有序集合添加 2 个元素）
r.zadd('zset_key1', {'zset_item1_1': 1, 'zset_item1_2': 2})
r.zadd('zset_key2', {'zset_item2_1': 3, 'zset_item2_2': 4})
r.zadd('zset_key3', {'zset_item3_1': 5, 'zset_item3_2': 6})
r.zadd('zset_key4', {'zset_item4_1': 7, 'zset_item4_2': 8})
r.zadd('zset_key5', {'zset_item5_1': 9, 'zset_item5_2': 10})
r.zadd('zset_key6', {'zset_item6_1': 11, 'zset_item6_2': 12})

print("30 个键值对设置完成。")